package cn.buddha.jesdp.proxy.demo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author shihao
 * @version 1.0
 * @className PayProxyHandler
 * @description 调用处理程序
 * @date 2022/1/8 0008 16:11
 **/
public class PayProxyHandler implements InvocationHandler {

    private Pay pay;

    public PayProxyHandler(Pay pay) {
        this.pay = pay;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.err.println("输入支付密码");
        Object result = method.invoke(pay, args);
        System.err.println("支付完成");

        return result;
    }

}
